import React from 'react';
import { Drawer, Button } from 'antd';

class Components extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      height: 600,
    };
  }
  componentDidMount() {
    let height = window.screen.availHeight;
    this.setState({
      height,
    });
  }

  render() {
    const { visible, close, token } = this.props;
    const { height } = this.state;

    return (
      <Drawer
        maskClosable={false}
        destroyOnClose
        visible={visible}
        placement="left"
        width="1000"
        onClose={close}
      >
        <div style={{ padding: '20px 0px' }}>
          <iframe
            width="100%"
            height={`${height}`}
            id="webssh"
            src={`http://60.255.160.14:9527?token=${token}`}
            frameBorder="0"
          />
        </div>
      </Drawer>
    );
  }
}

export default Components;
